//
//  NSObject+extension.m
//  PhoneCall
//
//  Created by 张伟 on 2021/5/19.
//

#import "NSObject+extension.h"

@implementation NSObject (extension)

- (NSString *)getCurrentAppVersion{
    NSDictionary * info = NSBundle.mainBundle.infoDictionary;
    return [info objectForKey:@"CFBundleShortVersionString"];
}

- (void)copyString:(NSString *)str{
    UIPasteboard * pasteBoard = [UIPasteboard generalPasteboard];
    [pasteBoard setString:str];
}

- (void)shareObject:(NSArray *)objs{
    NSArray *images = objs;
    UIActivityViewController * activityController = [[UIActivityViewController alloc]initWithActivityItems:images applicationActivities:nil];
    
    activityController.completionWithItemsHandler =^(UIActivityType __nullable activityType, BOOL completed, NSArray * __nullable returnedItems, NSError * __nullable activityError){
        if (completed) {
            [ZWHud showMessage:@"分享成功" finishHandle:nil];
        }else{
            [ZWHud showMessage:@"分享失败" finishHandle:nil];
        }
    };
    
    [ZWTools.currentTopViewController presentViewController:activityController animated:YES completion:nil];
}
@end
